Skip to main content
GET
/
client
/
v1
/
validate
Validate Voucher (client-side) [Deprecated]
curl --request GET \
  --url https://{cluster}.voucherify.io/client/v1/validate \
  --header 'Authorization: Bearer <token>' \
  --header 'X-Client-Application-Id: <api-key>' \
  --header 'X-Client-Token: <api-key>' \
  --header 'origin: <origin>'
{
"valid": false,
"reason": "customer does not match validation rules",
"error": {
"message": "Only the gift card owner can apply credits from the gift card to the order."
},
"tracking_id": "track_0nmdnu/6xIb6NTN0Ea40oFmM4wD5QYlxAgKdSn6wh+o",
"code": "GIFT-CARD-kW4aEsfB",
"metadata": {}
}

Authorizations

X-Client-Application-Id
string
header
required
X-Client-Token
string
header
required
Authorization
string
header
required

The access token received from the authorization server in the OAuth 2.0 flow.

Headers

origin
string<hostname>
required

Indicates the origin (scheme, hostname, and port).

Query Parameters

code
string

A code that identifies the voucher.

Example:

"2CpRCE2c"

tracking_id
string

A tracking identifier of a user that validated the voucher. This identifier is generated during voucher validation based on your internal ID (e.g., email, database ID) during the first request. This is a hashed customer source ID. If the request is performed for the first time, pass the internal ID to track the customer. Although not all information is required, the extra information helps prevent fraud.

amount
string

A positive integer in the smallest currency unit (e.g. 100 cents for $1.00) representing the total amount of the order. This is the sum of the order items' amounts.

session_key
string

The session unique ID assigned by Voucherify or your own unique session ID. Sending an existing ID will result in overwriting an existing session. If no session key is provided, then a new ID will be generated.

Example:

"ssn_yQGMTeKBSw8OOuFPwlBEjzGy8d8VA9Ts"

session_ttl
integer

Value for the period of time that the session is active. Units for this parameter are defined by the session_ttl_unit parameter.

session_ttl_unit
enum<string>

Defines the type of unit in which the session time is counted.

Available options:
HOURS,
DAYS,
MINUTES,
SECONDS,
MILLISECONDS,
MICROSECONDS,
NANOSECONDS
metadata
object

Metadata key value pairs.

item
Order Item · object[]

Array of order items.

session_type
string

The session is required to establish a session between multiple parallel validation and redemption requests. This parameter is required to establish a new session. The session locks the redemption quantity by 1 and additionally the redemption gift credits specified within the request for a gift card and the loyalty points for a loyalty card.

customer

Customer details. Customer source ID and/or customer metadata.

order
object

Order details.

Response

Returns information whether the voucher is valid in the context of the parameter values provided in the query parameters. Moreover, it returns a hashed source identifier which can be used as tracking ID in future calls. If a validation session is established, then the session details will be returned as well. Read more on <!-- [validation sessions](..docs/guides/campaign_recipes/Locking-Validation-Session.md) -->validation sessions.

  • Valid - Discount Code
  • Valid - Gift Card
  • Valid - Loyalty Card
  • Not Valid

Response schema model for validating a voucher using POST v1/vouchers/{code}/validate. Response schema model for validating a discount code using POST v1/vouchers/{code}/validate.

valid
boolean

Indicates whether the voucher is valid within the context of the parameters provided in the request body.

applicable_to
object

Contains list of items that qualify in the scope of the discount. These are definitions of included products, SKUs, and product collections. These can be discounted.

inapplicable_to
object

Contains list of items that do not qualify in the scope of the discount. These are definitions of excluded products, SKUs, and product collections. These CANNOT be discounted.

tracking_id
string

Hashed customer source ID.

order
object

This is an object representing an order with calculated discounts applied using the voucher code.

  • Order object - Effect: Apply to order
  • Order object - Effect: Apply to items
code
string

Voucher code.

discount
object

Contains information about the discount to be applied to the order. This is an object representing the discount that the customer would receive in the context of the provided request body parameters. If the discount is calculated based on a formula, this object will return either the discount calculated based on the formula or the fallback value.

  • Amount Discount
  • Percent Discount
  • Fixed Discount
  • Unit Discount, Product
  • Unit Discount, SKU
  • Unit Discount, multiple items
  • Shipping Discount
metadata
object

The metadata object stores all custom attributes assigned to the code. A set of key/value pairs that you can attach to a voucher object. It can be useful for storing additional information about the voucher in a structured format.

start_date
string<date-time>

Activation timestamp defines when the voucher starts to be active in ISO 8601 format. Voucher is inactive before this date.

Example:

"2022-10-04T00:00:00.000Z"

expiration_date
string<date-time>

Expiration timestamp defines when the voucher expires in ISO 8601 format. Voucher is inactive after this date.

Example:

"2022-10-31T00:00:00.000Z"

campaign
string

Voucher's parent campaign name.

campaign_id
string

Voucher's parent campaign's unique ID.

Example:

"camp_W8DJVd8J0btqXT6FBwn7BSkC"

session
object

Schema model for session lock object. The session object contains information about the session key that was used to establish a session between multiple parallel validation and redemption requests.

I